<?php

namespace app\common\validate;

use think\Validate;

class UserRecyclerInfo extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'user_id'   => 'require',
        'region_id' => 'require|between:1,9999999999',
        'name'      => 'require|length:2,20',
        'mobile'    => 'require|regex:^1[0-9]{10}$',
        'idcard'    => 'require|length:15,18',
        'positive'  => 'require|length:1,255',
        'back'      => 'require|length:1,255',
        'lng'       => 'require|float',
        'lat'       => 'require|float',
        'address'   => 'require|length:1,255',
        'remarks'   => 'length:0,255',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'user_id'           => '请先登录',
        'region_id'         => '回收片区不能为空',
        'name'              => '真实姓名不能为空',
        'name.length'       => '姓名错误',
        'mobile'            => '联系电话不能为空',
        'mobile.regex'      => '电话格式错误',
        'idcard'            => '身份证编号不能为空',
        'idcard.length'     => '身份证编号格式错误',
        'positive'          => '身份证正面照不能为空',
        'positive.length'   => '身份证正面照错误',
        'back'              => '身份证反面照不能为空',
        'back.length'       => '身份证反面照错误',
        'lng'               => '经度不能为空',
        'lng.float'         => '经度错误',
        'lat'               => '纬度不能为空',
        'lat.float'         => '纬度错误',
        'address'           => '联系地址错误',
        'address.length'    => '联系地址长度最长255个字符',
        'remarks.length'    => '个人简介长度最长255个字符'
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['user_id', 'region_id', 'name', 'mobile', 'idcard', 'positive', 'back', 'lng', 'lat', 'address', 'remarks'],
        'edit' => [],
    ];
}